Como implementar en React-Native el SDK de Google Navigation.
Código de Ejemplo (Está en Azure Devops se necesita cuenta con permisos)
npx react-native init ImplementacionLibNavSDK
npm install ..\NavigationSwoLibrary\navigation-swo-library-0.1.0.tgz
const path = require('path');
const root = path.resolve(__dirname, 'node_modules/navigation-swo-library');
projectRoot: __dirname,
watchFolders: [root],
Build.gradle a nivel proyecto (android/build.gradle), añadimos las siguientes configuraciones:
plugins {
id "com.google.cloud.artifactregistry.gradle-plugin" version "2.1.1"
}
maven {url "artifactregistry://us-west2-maven.pkg.dev/gmp-artifacts/transportation"}
configurations {
implementation {
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
}
Build.gradel a nivel app (android/app/build.gradle), añadimos la siguiente linea al principio:
apply plugin: 'com.google.cloud.artifactregistry.gradle-plugin'
import React from 'react';
import {
Button,
View,
} from 'react-native';
import { openNavigationActivity } from 'navigation-swo-library';
const App = () => {
return (
<View style={{padding: 10}}>
<Button
title="Press me"
onPress={() => openNavigationActivity("ChIJp3Hd4kT-Lg0REeOHwIhoFOA")}
/>
</View>
);
}
export default App;
Google Navigation | SDK